Computer systems typically include a combination of computer hardware (such as semiconductors, circuit boards, processors, and storage devices) and computer programs. The computer programs are stored in the storage devices and are executed by the processors. Computers are often general purpose, meaning that the functions that the computer performs on the data may be altered by altering the computer programs that execute on the computer.
Human programmers often write computer programs in a form of computer language, called source code, that is relatively easy for a human to understand, but which is not efficient or possible for the processor to execute. Another program, called a compiler, then transforms or translates the source code into a form, often called object code, which is more efficient or possible for the processor in the computer to execute, but relatively difficult for a human to understand. A compiler may exist as a stand-alone compiler or may be used as part of an interpreter.
A type of compiler, called an optimizing compiler, attempts to analyze the statements or instructions within the program in order to produce object code that will execute faster or use less memory. Techniques for optimizing the object code include avoiding redundancy by reusing results that have already been computed and storing them for later use instead of re-computing them, removing unnecessary computations and intermediate values, placing code and data that are accessed closely together in time close together in memory, re-ordering instructions to allow multiple computations to happen in parallel, combining the body of loops that iterate the same number of times if they make no reference to each other's data, moving calculations that compute the same value for each iteration from inside the loop to outside the loop, and replacing expressions consisting of constants with their final value at compile-time, rather than performing the calculation at run-time, among others.